package com.imooc.mapping.course5;

import com.imooc.mapping.course5.copier.MetadataCopier;
import lombok.AllArgsConstructor;

import java.util.Objects;

/**
 * @Author Tim
 * @Description:
 * @Version 1.0
 *
 * 包装类型
 */
@AllArgsConstructor
public abstract class MetadataDecorator implements MetadataCopier {

    private final MetadataCopier delegate;

//    public MetadataDecorator(MetadataCopier delegate){
//        this.delegate = delegate;
//    }

    @Override
    public Metadata metadataCopier(TDataCenterMetadata metadata) {
        Metadata mdModel = delegate.metadataCopier(metadata);
        mdModel.setSex(Objects.equals(metadata.getSex(), 1) ? "男生":"女生");
        return mdModel;
    }
}
